﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CashFlow.Entities.Models;
using CashFlow.Entities;

namespace CashFlow.FakeData
{
	public static class BillProvider
	{
		#region Bills
		public static IEnumerable<Bill> GetBills()
		{
			var tenant = new Tenant { Id = "1", PublicId = "Pub1" };
			var bills = new List<Bill> { 
				new Bill {
					Id = "63d72470790a428bafafa3f8ae187348",
					Account = Account.GetDefault(),
					Amount = 100,
					Details = "Details 1",
					FirstDate = DateTime.Now.AddDays(1),
					LastDate = DateTime.Now.AddMonths(5),
					NextDate = DateTime.Now.AddDays(1),
					Payee = new Payee {Id = "p1", Name = "Payee 1", Tenant = tenant},
					Recurrence = new RecurrenceOnce(),
					Tenant = tenant
				},
				new Bill {
					Id = "29cc1023d62f4071b61beade539b7d9c",
					Account = Account.GetDefault(),
					Amount = 50,
					Details = "Details 2",
					FirstDate = DateTime.Now.AddDays(3),
					LastDate = DateTime.Now.AddMonths(2),
					NextDate = DateTime.Now.AddDays(3),
					Payee = new Payee {Id = "p1", Name = "Payee 1", Tenant = tenant},
					Recurrence = new RecurrenceOnce(),
					Tenant = tenant
				},
				new Bill {
					Id = "24ac3cac8cf546bf827f13521df1d928",
					Account = Account.GetDefault(),
					Amount = 1000,
					Details = "Details 3",
					FirstDate = DateTime.Now.AddDays(10),
					LastDate = DateTime.Now.AddMonths(15),
					NextDate = DateTime.Now.AddDays(10),
					Payee = new Payee {Id = "p2", Name = "Payee 2", Tenant = tenant},
					Recurrence = new RecurrenceOnce(),
					Tenant = tenant
				},
				new Bill {
					Id = "190c41f90b6e47ed93e0e8d157961ba7",
					Account = Account.GetDefault(),
					Amount = 1500,
					Details = "Bill In TP",
					FirstDate = DateTime.Now.AddDays(-20),
					LastDate = DateTime.Now.AddMonths(5),
					Payee = new Payee {Id = "p3", Name = "Payee 3", Tenant = tenant},
					Recurrence = new RecurrenceOnce(),
					Tenant = tenant
				}
			};
			return bills;
		}

		public static IEnumerable<BillListModel> GetBillListModel()
		{
			var model = GetBills().Select(b => (BillListModel)b);
			return model;
		}

		public static BillModel GetBillModelByBillId(string id)
		{
			var bill = GetBills().FirstOrDefault(b => b.Id == id);
			return (BillModel)bill;
		}

		#endregion

	}
}
